const validate = require("@/utils/validate");
const { body } = require("express-validator");

const append = validate([
  body("username")
    .notEmpty()
    .trim()
    .withMessage("请输入账号")
    .isAlpha()
    .withMessage("账号由大小写字母组成")
    .isLength({ min: 4, max: 10 })
    .withMessage("账号长度4-10个字符"),
  body("email")
    .notEmpty()
    .withMessage("请输入邮箱")
    .isEmail()
    .withMessage("邮箱格式不正确"),
  body("avatar").notEmpty().withMessage("请输入头像地址"),
  body("nickname").notEmpty().withMessage("请输入昵称"),
  body("dept_id").notEmpty().withMessage("请选择部门"),
  body("role_id").notEmpty().withMessage("请选择角色"),
]);

module.exports = { append };
